﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SJ.Platform.Extend.Response
{
    /// <summary>
    /// 分页查询响应结果
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ApiPageQueryResponse<T> : ApiResponse
    {
        public int PageIndex { get; set; }
        public int PageSize { get; set; }
        public int Count { get; set; }
        public T Data { get; set; } = default!;

        public static ApiPageQueryResponse<T> SetResponse(ApiResponseStatus status, string message, int pageIndex, int pageSize, int count, T data)
        {
            return new ApiPageQueryResponse<T>
            {
                Code = ((int)status).ToString(),
                Message = message,
                PageIndex = pageIndex,
                PageSize = pageSize,
                Count = count,
                Data = data
            };
        }
    }
}
